<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>使用 postMessage()</title>
</head>
<body>
  <script>
    const factorialWorker = new Worker('./27_2_9_1_factorialWorker.js');

    factorialWorker.onmessage = ({ data }) => console.log(data);

    factorialWorker.postMessage(5);
    factorialWorker.postMessage(7);
    factorialWorker.postMessage(10);

    // 5! = 120
    // 7! = 5040
    // 10! = 3628800
  </script>
</body>
</html>